package com.qy137.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qy137.entity.Staff;
import com.qy137.mapper.StaffMapper;
import com.qy137.service.IStaffService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qy137.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 皇子明
 * @since 2021-08-27
 */
@Service
public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements IStaffService {
    @Resource
    private StaffMapper staffMapper;
    @Override
    public Result findByUserAndPassword(String username, String password) {
        QueryWrapper<Staff> wrapper = new QueryWrapper<>();
        wrapper.eq("stf_phone",username);
        wrapper.eq("stf_password",password);
        Staff staff = staffMapper.selectOne(wrapper);
        if (staff!=null){
           return Result.success();
        }else {
            return Result.fail();
        }
    }
}
